<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 父构造函数
      function Father(name, age) {
        // this指向父构造函数的对象实例
        this.name = name;
        this.age = age;
      }
      // 子构造函数
      function Son(name, age, score) {
        // this 指向子构造函数的对象实例
        Father.call(this, name, age); // 调用父构造函数 把父构造函数的this指向 修改为子构造函数的this
        this.score = score;
      }
      var son = new Son("zzc", 18, 100);
      console.log(son);
    </script>
  </body>
</html>
